import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class HttpServer {
    public static void main(String[] args) throws Exception {
        ServerSocket serverSocket = new ServerSocket(8801);

        while(true){
            try{
                Socket socket = serverSocket.accept();
                PrintWriter printWriter = new PrintWriter(socket.getOutputStream(),true);
                printWriter.println("HTTP/1.1 200 OK");
                printWriter.println("content-type: text/html; charset=UTF-8");
                //printWriter.println("content-type: text/html; charset=UTF-8"); content-length: 67582
                printWriter.println();
                printWriter.write("hello"+socket.getInetAddress().getHostAddress());
                printWriter.close();
                socket.close();
            }catch(Exception e){
                System.out.println(e);
            }
        }
    }
}

